package svn.apostila.android.svn.apostila;

import svn.apostila.android.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class android extends Activity 
{
	EditText edtNumero1,edtNumero2;
	Button  btnSomar;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        edtNumero1 = (EditText) findViewById(R.id.numero1);
        edtNumero2 = (EditText) findViewById(R.id.numero2);
        
        btnSomar = (Button) findViewById(R.id.btnSomar);
        
        btnSomar.setOnClickListener(new View.OnClickListener()
        {
        	 public void onClick(View arg0)
        	 {
        		 double num1 = Double.parseDouble(edtNumero1.getText().toString()); 
        	     double num2 = Double.parseDouble(edtNumero2.getText().toString()); 
        	     double res = num1 + num2; 
        	     
        	     AlertDialog.Builder dialogo = new 
        	     AlertDialog.Builder(android.this); 
        	     dialogo.setTitle("Aviso"); 
        	     dialogo.setMessage("Soma:" + res); 
        	     dialogo.setNeutralButton("OK", null); 
        	     dialogo.show();     
        	     
        	   } 
            });
    }
}